package controle;

import java.io.ObjectInputStream;
import java.net.Socket;

import gui.Gui;

public class ClienteBroadcastHandler extends Thread {

	private Socket conexao;
	private MensagemServidorBroadcast mensagem;
	private Gui gui;
		
	public ClienteBroadcastHandler(Socket conexao, Gui gui) {
		this.conexao	= conexao;
		this.gui		= gui;
	}
	
	public void run()
	{
		try
		{
			ObjectInputStream oi	=	new	ObjectInputStream(conexao.getInputStream());
			this.mensagem			=	(MensagemServidorBroadcast) oi.readObject();
			
			atualizarLista();
			conexao.close();
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
	}

	private void atualizarLista() {
		// TODO Auto-generated method stub
		this.gui.setClienteGui(mensagem);
		
	}


}
